home *** CD-ROM | disk | FTP | other *** search
- _global.GWCollapsiblePaneClass = function()
- {
- super.init(GWCollapsiblePaneClass);
- };
- GWCollapsiblePaneClass.prototype = new GWBaseClass();
- Object.registerClass("GWCollapsiblePaneClass",GWCollapsiblePaneClass);
- GWCollapsiblePaneClass.prototype.init = function()
- {
- this.startIndex = this.startIndex || 0;
- this.width = Math.round(this._width);
- this.height = Math.round(this._height);
- this._xscale = this._yscale = 100;
- this.pane_mc._visible = 0;
- var _loc3_ = [];
- var _loc4_ = this.labels.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc4_)
- {
- _loc3_[_loc2_] = {};
- _loc3_[_loc2_].label = this.labels[_loc2_];
- _loc3_[_loc2_].data = this.data[_loc2_];
- _loc2_ = _loc2_ + 1;
- }
- this.setDataProvider(_loc3_);
- };
- GWCollapsiblePaneClass.prototype.getDataProvider = function()
- {
- var _loc3_ = [];
- var _loc4_ = this.panes.length || 0;
- var _loc2_ = 0;
- while(_loc2_ < _loc4_)
- {
- _loc3_[_loc2_] = {};
- _loc3_[_loc2_].label = this.panes[_loc2_].label;
- _loc3_[_loc2_].data = this.panes[_loc2_].data;
- if(this.panes[_loc2_].icon)
- {
- _loc3_[_loc2_].icon = this.panes[_loc2_].icon;
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc3_;
- };
- GWCollapsiblePaneClass.prototype.setDataProvider = function(d)
- {
- var _loc3_ = this.panes.length || 0;
- var _loc2_ = 0;
- while(_loc2_ <= _loc3_)
- {
- this["pane" + _loc2_ + "_mc"].removeMovieClip();
- _loc2_ = _loc2_ + 1;
- }
- this.panes = [];
- _loc3_ = d.length;
- _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- this.addPane(d[_loc2_]);
- _loc2_ = _loc2_ + 1;
- }
- if(this.startIndex != -1)
- {
- this.expand(this.startIndex);
- }
- this.setSize(this.width);
- };
- GWCollapsiblePaneClass.prototype.addPane = function()
- {
- var _loc7_ = typeof arguments[0] != "object" ? {data:arguments[0],label:arguments[1]} : arguments[0];
- var _loc4_ = this.panes.length;
- this.panes.push(_loc7_);
- var _loc3_ = "pane" + _loc4_ + "_mc";
- this.pane_mc.duplicateMovieClip(_loc3_,_loc4_);
- this[_loc3_].paneID = _loc4_;
- this[_loc3_]._y = this["pane" + (_loc4_ - 1) + "_mc"]._y + (!this["pane" + (_loc4_ - 1) + "_mc"].expanded ? this["pane" + (_loc4_ - 1) + "_mc"].titlebar_mc._height : this["pane" + (_loc4_ - 1) + "_mc"]._height);
- this.setPaneLabel(this.panes[_loc4_].label,_loc4_);
- this.setPaneContent(this.panes[_loc4_].data,_loc4_);
- this.drawBox("mask_mc",-1,0,0,this.width - 4,this[_loc3_].titlebar_mc._height,0,100,this[_loc3_].label_mc);
- this[_loc3_].label_mc.setMask(this[_loc3_].label_mc.mask_mc);
- this[_loc3_].titlebar_mc.useHandCursor = false;
- this[_loc3_].titlebar_mc.onRollOver = function()
- {
- var _loc3_ = new TextFormat();
- _loc3_.color = this._parent._parent.fontcolor_on;
- this._parent.label_mc.label_txt.setTextFormat(_loc3_);
- if(this._parent.arrow_mc.over_mc != undefined)
- {
- for(var _loc2_ in this._parent.arrow_mc)
- {
- this._parent.arrow_mc[_loc2_]._visible = 0;
- }
- if(this._parent.expanded)
- {
- this._parent.arrow_mc.down_over_mc._visible = 1;
- }
- else
- {
- this._parent.arrow_mc.over_mc._visible = 1;
- }
- }
- else
- {
- var _loc4_ = new Color(this._parent.arrow_mc);
- _loc4_.setRGB(this._parent._parent.fontcolor_on);
- }
- };
- this[_loc3_].titlebar_mc.onDragOut = this[_loc3_].titlebar_mc.onReleaseOutside = this[_loc3_].titlebar_mc.onRollOut = function()
- {
- var _loc3_ = new TextFormat();
- _loc3_.color = this._parent._parent.fontcolor;
- this._parent.label_mc.label_txt.setTextFormat(_loc3_);
- if(this._parent.arrow_mc.over_mc != undefined)
- {
- for(var _loc2_ in this._parent.arrow_mc)
- {
- this._parent.arrow_mc[_loc2_]._visible = 0;
- }
- if(this._parent.expanded)
- {
- this._parent.arrow_mc.down_mc._visible = 1;
- }
- else
- {
- this._parent.arrow_mc.out_mc._visible = 1;
- }
- }
- else
- {
- var _loc4_ = new Color(this._parent.arrow_mc);
- _loc4_.setRGB(this._parent._parent.fontcolor);
- }
- };
- this[_loc3_].titlebar_mc.onRelease = function()
- {
- if(this._parent.expanded)
- {
- this._parent._parent.collapse(this._parent.paneID);
- }
- else
- {
- if(this._parent._parent.mode == "Accordion")
- {
- this._parent._parent.collapseAll();
- }
- this._parent._parent.expand(this._parent.paneID);
- }
- this.onRollOver();
- };
- };
- GWCollapsiblePaneClass.prototype.collapse = function(id)
- {
- if(id == undefined)
- {
- return this.collapseAll();
- }
- var _loc3_ = this["pane" + id + "_mc"];
- if(_loc3_ == undefined || id == undefined)
- {
- return undefined;
- }
- for(var _loc2_ in _loc3_.arrow_mc)
- {
- _loc3_.arrow_mc[_loc2_]._visible = false;
- }
- _loc3_.content_mc._visible = _loc3_.expanded = false;
- _loc3_.arrow_mc.out_mc._visible = true;
- var _loc5_ = this.panes.length;
- var _loc2_ = id;
- while(_loc2_ < _loc5_)
- {
- this["pane" + _loc2_ + "_mc"]._y = this["pane" + (_loc2_ - 1) + "_mc"]._y + (!this["pane" + (_loc2_ - 1) + "_mc"].expanded ? 0 : this.getPaneSize(_loc2_ - 1).height) + (this["pane" + (_loc2_ - 1) + "_mc"].titlebar_mc.height || this["pane" + (_loc2_ - 1) + "_mc"].titlebar_mc._height);
- _loc2_ = _loc2_ + 1;
- }
- this.onCollapse(id);
- };
- GWCollapsiblePaneClass.prototype.expand = function(id)
- {
- if(id == undefined)
- {
- return this.expandAll();
- }
- var _loc3_ = this["pane" + id + "_mc"];
- if(_loc3_ == undefined)
- {
- return undefined;
- }
- for(var _loc2_ in _loc3_.arrow_mc)
- {
- _loc3_.arrow_mc[_loc2_]._visible = false;
- }
- _loc3_.arrow_mc.down_mc._visible = _loc3_.content_mc._visible = _loc3_.expanded = true;
- var _loc5_ = this.panes.length;
- var _loc2_ = id;
- while(_loc2_ <= _loc5_)
- {
- this["pane" + (_loc2_ + 1) + "_mc"]._y = this["pane" + _loc2_ + "_mc"]._y + (!this["pane" + _loc2_ + "_mc"].expanded ? 0 : this.getPaneSize(_loc2_).height) + (this["pane" + _loc2_ + "_mc"].titlebar_mc.height || this["pane" + _loc2_ + "_mc"].titlebar_mc._height);
- _loc2_ = _loc2_ + 1;
- }
- this.onExpand(id);
- };
- GWCollapsiblePaneClass.prototype.expandAll = function()
- {
- var _loc3_ = this.panes.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- if(!this["pane" + _loc2_ + "_mc"].expanded)
- {
- this.expand(_loc2_);
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- GWCollapsiblePaneClass.prototype.collapseAll = function()
- {
- var _loc3_ = this.panes.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- if(this["pane" + _loc2_ + "_mc"].expanded)
- {
- this.collapse(_loc2_);
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- GWCollapsiblePaneClass.prototype.getSize = function()
- {
- var _loc4_ = undefined;
- var _loc3_ = this.panes.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- _loc4_ += this["pane" + _loc2_ + "_mc"].titlebar_mc._height + (!this["pane" + _loc2_ + "_mc"].expanded ? 0 : this["pane" + _loc2_ + "_mc"].content_mc.base_mc.height);
- _loc2_ = _loc2_ + 1;
- }
- return {width:this.width,height:_loc4_};
- };
- GWCollapsiblePaneClass.prototype.setSize = function(w)
- {
- var _loc0_ = null;
- w = this.width = Math.round(w);
- var _loc3_ = this.panes.length;
- var _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- this.setPaneSize(w,0,_loc2_);
- if(this.getPaneContent(_loc2_).data_txt)
- {
- this.loadText(this.panes[_loc2_].data,_loc2_);
- }
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- while(_loc2_ < _loc3_)
- {
- this.width = Math.max(this.width,this.getPaneSize(_loc2_).width);
- if(this.getPaneSize(_loc2_).width < this.width)
- {
- this.setSize(this.width);
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- };
- GWCollapsiblePaneClass.prototype.getPaneContent = function(id)
- {
- if(this["pane" + id + "_mc"].content_mc.holder_mc == undefined)
- {
- this["pane" + id + "_mc"].content_mc.createEmptyMovieClip("holder_mc",1);
- }
- return this["pane" + id + "_mc"].content_mc.holder_mc;
- };
- GWCollapsiblePaneClass.prototype.loadText = function(t, id)
- {
- if(t.length)
- {
- this["pane" + id + "_mc"].content_mc.holder_mc.removeMovieClip();
- this["pane" + id + "_mc"].content_mc.createEmptyMovieClip("holder_mc",1);
- this["pane" + id + "_mc"].content_mc.holder_mc.createTextField("data_txt",1,this.pad,this.pad,this.width - this.pad * 2,0);
- var _loc3_ = new TextFormat();
- _loc3_.font = this.font;
- _loc3_.size = this.fontsize;
- _loc3_.color = this.textcolor;
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.setNewTextFormat(_loc3_);
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.autoSize = "left";
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.selectable = false;
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.wordWrap = true;
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.html = true;
- if(this.useEmbedFonts)
- {
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.embedFonts = true;
- }
- this["pane" + id + "_mc"].content_mc.holder_mc.data_txt.htmlText = "<font color=\'#" + this.textcolor.toString(16) + "\' size=\'" + this.fontsize + "\' face=\'" + this.font + "\'>" + t + "</font>";
- this.setPaneSize(this.width,0,id);
- this.expand(id);
- }
- };
- GWCollapsiblePaneClass.prototype.setPaneContent = function(m, id)
- {
- this["pane" + id + "_mc"].content_mc.holder_mc.removeMovieClip();
- this["pane" + id + "_mc"].content_mc.attachMovie(m,"holder_mc",1,{_x:this.pad,_y:this.pad});
- if(!this["pane" + id + "_mc"].content_mc.holder_mc)
- {
- this.loadText(m,id);
- }
- this.collapse(id);
- };
- GWCollapsiblePaneClass.prototype.getPaneSize = function(id)
- {
- return {width:this["pane" + id + "_mc"].content_mc.base_mc.width || this["pane" + id + "_mc"].content_mc.base_mc._width,height:this["pane" + id + "_mc"].content_mc.base_mc.height || this["pane" + id + "_mc"].content_mc.base_mc._height};
- };
- GWCollapsiblePaneClass.prototype.setPaneSize = function(w, h, id)
- {
- if(this.resizeToFit)
- {
- this.width = w = Math.max(w,Math.max(this["pane" + id + "_mc"].label_mc._x + this["pane" + id + "_mc"].label_mc._width + 4,(this["pane" + id + "_mc"].content_mc.holder_mc._width || 0) + this.pad * 2));
- }
- h = h || (this["pane" + id + "_mc"].content_mc.holder_mc._height || 0) + this.pad * 2;
- if(this["pane" + id + "_mc"].content_mc.base_mc.width != w || this["pane" + id + "_mc"].content_mc.base_mc.height != h)
- {
- this.sizeMe(w,h,this["pane" + id + "_mc"].content_mc.base_mc);
- }
- if(this["pane" + id + "_mc"].titlebar_mc.width != w)
- {
- this.sizeMe(w,this["pane" + id + "_mc"].titlebar_mc._height,this["pane" + id + "_mc"].titlebar_mc);
- }
- this["pane" + id + "_mc"].label_mc.mask_mc._width = w - 4;
- this.drawBox("mask_mc",-1,this.pad,this.pad,w - this.pad * 2,h - this.pad * 2,0,0,this["pane" + id + "_mc"].content_mc);
- this["pane" + id + "_mc"].content_mc.holder_mc.setMask(this["pane" + id + "_mc"].content_mc.mask_mc);
- !this["pane" + id + "_mc"].expanded ? this.collapse(id) : this.expand(id);
- };
- GWCollapsiblePaneClass.prototype.getPaneLabel = function(i)
- {
- return this["pane" + i + "_mc"].label_mc.label_txt.text;
- };
- GWCollapsiblePaneClass.prototype.setPaneLabel = function(l, i)
- {
- this["pane" + i + "_mc"].createEmptyMovieClip("label_mc",1);
- this["pane" + i + "_mc"].label_mc.createTextField("label_txt",2,0,0,this.width,this.height);
- var _loc3_ = new TextFormat();
- _loc3_.font = this.font;
- _loc3_.size = this.fontsize;
- _loc3_.color = this.fontcolor;
- _loc3_.bold = false;
- this["pane" + i + "_mc"].label_mc.label_txt.autoSize = "center";
- this["pane" + i + "_mc"].label_mc.label_txt.selectable = false;
- if(this.useEmbedFonts)
- {
- this["pane" + i + "_mc"].label_mc.label_txt.embedFonts = true;
- }
- this["pane" + i + "_mc"].label_mc.label_txt.html = true;
- this["pane" + i + "_mc"].label_mc.label_txt.htmlText = this.panes[i].label = l;
- this["pane" + i + "_mc"].label_mc.label_txt.setTextFormat(_loc3_);
- };
-